# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: Philipp Claßen <philipp.classen@posteo.de>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - -DBENCHMARK_ENABLE_LTO=OFF

pkgname=benchmark
pkgver=1.8.5
pkgrel=1
pkgdesc="A microbenchmark support library"
arch=('x86_64')
url="https://github.com/google/benchmark"
license=('Apache-2.0')
depends=('gcc-libs')
makedepends=('cmake')

source=("https://github.com/google/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('d26789a2b46d8808a48a4556ee58ccc7c497fcd4c0af9b90197674a81e04798a')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  mkdir -p build
}

build() {
  cd "$srcdir/$pkgname-$pkgver/build"

  cmake \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG -Wno-error=restrict" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DBUILD_SHARED_LIBS=ON \
    -DBENCHMARK_ENABLE_LTO=OFF \
    -DBENCHMARK_ENABLE_GTEST_TESTS=OFF \
    ..

  make VERBOSE=1
}

package() {
  cd "$srcdir/$pkgname-$pkgver/build"
  make DESTDIR="$pkgdir/" install
}
